Payment module#94
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a payment module with support for asset management and token splitting functionality. The changes introduce new data structures for payment assets, token split operations with Merkle tree-based verification, and updates to transaction handling to support these features.
Changes:
- Added payment asset infrastructure (AssetId, Asset, PaymentAssetCollection) for managing fungible tokens
- Implemented token splitting functionality with cryptographic proofs using sparse Merkle trees
- Updated transaction classes to include sourceStateHash as a direct property instead of computing it on-demand
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/functional/payment/TestSplitPaymentData.ts | Test helper class for split payment data serialization |
| tests/functional/payment/TestPaymentData.ts | Test helper class for payment data serialization |
| tests/functional/payment/SplitBuilderTest.ts | Functional tests for token splitting with validation checks |
| tests/functional/TransitionFlowTest.ts | Updated test to use factory method and added double-spend test |
| tests/functional/TestAggregatorClient.ts | Updated to use PayToPublicKeyPredicate.TYPE constant |
| src/util/InclusionProofUtils.ts | Added blank line for formatting |
| src/transaction/TransferTransaction.ts | Added predicate validation check |
| src/transaction/TokenId.ts | Removed unused fromNameTag method |
| src/transaction/Token.ts | Added id and type getter properties |
| src/transaction/MintTransaction.ts | Added sourceStateHash property and updated calculation |
| src/transaction/ITransaction.ts | Added sourceStateHash to interface |
| src/transaction/CertifiedMintTransaction.ts | Added sourceStateHash getter |
| src/predicate/builtin/PayToPublicKeyPredicate.ts | Updated to use sourceStateHash property |
| src/predicate/builtin/BuiltInPredicateVerifierFactory.ts | Added factory method using TYPE constant |
| src/payment/predicate/builtin/BurnPredicate.ts | New predicate type for burn operations |
| src/payment/error/TokenAssetValueMismatchError.ts | Error class for asset value mismatches |
| src/payment/error/TokenAssetMissingError.ts | Error class for missing assets |
| src/payment/error/TokenAssetCountMismatchError.ts | Error class for asset count mismatches |
| src/payment/asset/PaymentAssetCollection.ts | Collection class for managing payment assets |
| src/payment/asset/AssetId.ts | Identifier class for fungible assets |
| src/payment/asset/Asset.ts | Class representing a fungible asset with id and value |
| src/payment/TokenSplit.ts | Core implementation of token splitting with Merkle proof verification |
| src/payment/SplitReasonProof.ts | Proof data for token split verification |
| src/payment/SplitReason.ts | Container for split reason token and proofs |
| src/payment/ISplitPaymentData.ts | Interface for payment data with split reason |
| src/payment/IPaymentData.ts | Base interface for payment data |
| src/api/StateId.ts | Updated to use sourceStateHash property |
| src/api/CertificationData.ts | Updated to use sourceStateHash property |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MastaP
left a comment
There was a problem hiding this comment.
are there e2e tests to run against the real aggregator?
| } | ||
|
|
||
| public get(id: AssetId): Asset | null { | ||
| return this._assets.get(HexConverter.encode(id.bytes)) ?? null; |
#96 Use plain hash instead of imprints in certification data
Task #91
Added assets support and token splits
Fix for TransferTransaction to give error when invalid owner predicate is used.
Fix for state hash calculations